package com.caojing.haolemai.ui.category.categoryadapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.caojing.haolemai.bean.categoryclickbean.ClickResultsBean;
import com.caojing.haolemai.bean.categoryclickbean.FiltersBean;
import com.caojing.haolemai.bean.categoryclickbean.FiltersNameBean;
import com.caojing.haolemai.view.MyGridView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by My on 2016/10/18.
 */
public class ListDrawerAdapter extends BaseAdapter {
    private Context mContext;
    private ClickResultsBean clickResultsBean;
    private final FiltersNameBean filtersName;
    private final List<FiltersBean> filters;
    private List<Map<String,String>> maps= new ArrayList<>();
    private GvdrawerAdapter gvadapter;


    public ListDrawerAdapter(Context context, ClickResultsBean list) {
        this.mContext = context;
        this.clickResultsBean = list;
        filtersName = clickResultsBean.getFiltersName();
        String category = filtersName.getCategory();
        String brand = filtersName.getBrand();
        String gender = filtersName.getGender();
        String size = filtersName.getSize();
        String price = filtersName.getPrice();
        String instock = filtersName.getInstock();
        Map<String,String> map = new HashMap();
        map.put("name",category);
        map.put("name",brand);
        map.put("name",gender);
        map.put("name",size);
        map.put("name",price);
        map.put("name",instock);
        maps.add(map);
        filters = clickResultsBean.getFilters();

       /* List<FiltersBean.CategoryBean> category1 = filters.get(0).getCategory();
        List<FiltersBean.BrandBean> brand1 = filters.get(1).getBrand();
        List<FiltersBean.GenderBean> gender1 = filters.get(2).getGender();
        List<FiltersBean.SizeBean> size1 = filters.get(3).getSize();
        List<FiltersBean.PriceBean> price1 = filters.get(4).getPrice();
        List<FiltersBean.InstockBean> instock1 = filters.get(5).getInstock();
*/
    }

    @Override
    public int getCount() {
        return maps != null ? maps.size() : 0;
    }

    @Override
    public Object getItem(int position) {
        return maps.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    /**
     * @param position
     * @param convertView
     * @param parent
     * @return
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

//        ViewHolder viewHolder;
//        if (convertView == null) {
//            convertView = LayoutInflater.from(mContext).inflate(R.layout.category_right_list_item, parent, false);
//            viewHolder = new ViewHolder(convertView);
//            convertView.setTag(viewHolder);
//        } else {
//            viewHolder = (ViewHolder) convertView.getTag();
//        }
//        Map<String, String> stringStringMap = maps.get(position);
//        stringStringMap.
//        viewHolder.tvCategoryRightList.setText(name);
//        CategoryRightListGvAdapter adapter= new CategoryRightListGvAdapter(mContext,filters);
//        viewHolder.categoryListGv.setAdapter(adapter);

        return convertView;
    }


//    static class ViewHolder {
//        @Bind(R.id.tv_category_right_list)
//        TextView tvCategoryRightList;
//        @Bind(R.id.category_list_gv)
//        MyGridView categoryListGv;
//
//        ViewHolder(View view) {
//            ButterKnife.bind(this, view);
//        }
//    }


}
